package com.aspose.cells;

import java.util.ArrayList;

class zht extends zj {
   private char[][] c;
   private int d;
   private int[] e;
   private int[] f;
   private int[] g;
   private int h;
   private int i;

   public zht(zhh var1, String var2) {
      super(var1, var2);
   }

   public int[] c() {
      return this.g;
   }

   public int d() {
      return this.d;
   }

   public boolean e() {
      return this.c.length < 2;
   }

   protected void a(char[] var1, int var2, int var3) {
      ArrayList var4 = new ArrayList(3);
      ArrayList var5 = null;
      ArrayList var6 = null;
      ArrayList var7 = null;
      StringBuilder var8 = new StringBuilder(var3 - var2);

      while(true) {
         while(var2 < var3) {
            label72:
            switch(var1[var2]) {
            case '"':
               ++var2;

               while(true) {
                  if (var2 >= var3 || var1[var2] == '"') {
                     break label72;
                  }

                  var8.append(var1[var2]);
                  ++var2;
               }
            case '*':
            case '_':
               if (var2 + 1 < var3) {
                  if (var5 == null) {
                     var5 = new ArrayList(3);
                     var6 = new ArrayList(3);
                     var7 = new ArrayList(3);
                  }

                  com.aspose.cells.b.a.a.ze.a(var5, (Object)var4.size());
                  com.aspose.cells.b.a.a.ze.a(var6, (Object)var8.length());
                  com.aspose.cells.b.a.a.ze.a(var7, (Object)zxz.a(var1[var2] == '*', var8.length(), var1[var2 + 1]));
                  ++var2;
               }
               break;
            case '@':
               if (var8.length() > 0) {
                  com.aspose.cells.b.a.a.ze.a(var4, (Object)com.aspose.cells.b.a.zr.a(var8));
                  var8.setLength(0);
               } else {
                  com.aspose.cells.b.a.a.ze.a(var4, (Object)null);
               }
               break;
            case '[':
               var2 = this.a.a(var1, var2, var3, (StringBuilder)null, true);
               continue;
            case '\\':
               ++var2;
               if (var2 < var3) {
                  var8.append(var1[var2]);
               }
               break;
            default:
               var8.append(var1[var2]);
            }

            ++var2;
         }

         if (var8.length() > 0) {
            com.aspose.cells.b.a.a.ze.a(var4, (Object)com.aspose.cells.b.a.zr.a(var8));
         } else {
            com.aspose.cells.b.a.a.ze.a(var4, (Object)null);
         }

         this.c = new char[var4.size()][];
         this.d = 0;

         int var9;
         for(var9 = 0; var9 < this.c.length; ++var9) {
            Object var10 = var4.get(var9);
            if (var10 != null) {
               this.c[var9] = ((String)var10).toCharArray();
               this.d += this.c[var9].length;
            }
         }

         if (var7 != null) {
            this.g = new int[var7.size()];
            this.e = new int[this.g.length];
            this.f = new int[this.g.length];

            for(var9 = 0; var9 < this.g.length; ++var9) {
               this.e[var9] = (Integer)var5.get(var9);
               this.f[var9] = (Integer)var6.get(var9);
               this.g[var9] = (Integer)var7.get(var9);
            }
         }

         return;
      }
   }

   public zxz a(zxu var1, int var2, Object var3) {
      return this.a(var1, var2, var3, false);
   }

   public zxz a(zxu var1, int var2, Object var3, boolean var4) {
      zxz var5 = super.a(var1, var2, var3);
      if (var5.f() != 7) {
         return var5;
      } else {
         switch(var2) {
         case 3:
            this.a(var1, com.aspose.cells.b.a.zr.a(var3).toUpperCase(), var5, var4);
            break;
         case 9:
            this.a(var1, (double)(Integer)var3, var5, var4);
            break;
         case 14:
            this.a(var1, (Double)var3, var5, var4);
            break;
         case 16:
            this.a(var1, this.a((DateTime)var3), var5, var4);
            break;
         default:
            this.a(var1, com.aspose.cells.b.a.zr.a(var3), var5, var4);
         }

         return var5;
      }
   }

   private void a(zxu var1, double var2, zxz var4, boolean var5) {
      if (this.e()) {
         this.a(var4, var2 < 0.0D);
      } else {
         this.a(var4, var5 ? "" : this.a.b().k().a(var1, 14, var2).h());
      }

   }

   private void a(zxu var1, String var2, zxz var3, boolean var4) {
      if (this.e()) {
         if (var4) {
            this.a(var3, false);
         } else {
            this.a(var3, var2);
         }
      } else {
         if (this.g != null) {
            var3.a(this.g);
         }

         char[] var5 = var2.toCharArray();
         char[] var6 = new char[this.d + var5.length * (this.c.length - 1)];
         this.h = 0;
         this.i = 0;
         this.a((char[])var6, 0, (zxz)var3);

         for(int var7 = 1; var7 < this.c.length; ++var7) {
            System.arraycopy(var5, 0, var6, this.h, var5.length);
            this.h += var5.length;
            this.a(var6, var7, var3);
         }

         var3.a(1, (char[])var6);
      }

   }

   private void a(zxz var1, String var2) {
      var1.a((int[])null);
      var1.a(Color.getEmpty());
      var1.a(1, (String)var2);
   }

   private void a(zxz var1, boolean var2) {
      if (this.g != null) {
         var1.a(this.g);

         for(int var3 = 0; var3 < this.g.length; ++var3) {
            var1.a(var3, var2 ? 1 + this.f[var3] : this.f[var3]);
         }
      }

      char[] var4;
      if (var2) {
         if (this.c[0] == null) {
            var4 = new char[]{'-'};
         } else {
            var4 = new char[this.c[0].length + 1];
            System.arraycopy(this.c[0], 0, var4, 1, this.c[0].length);
            var4[0] = '-';
         }
      } else if (this.c[0] == null) {
         var4 = zxz.a;
      } else {
         var4 = this.c[0];
      }

      var1.a(1, (char[])var4);
   }

   private void a(char[] var1, int var2, zxz var3) {
      if (this.g != null) {
         while(this.i < this.e.length && this.e[this.i] == var2) {
            var3.a(this.i, this.h + this.f[this.i]);
            ++this.i;
         }
      }

      char[] var4 = this.c[var2];
      if (var4 != null) {
         System.arraycopy(var4, 0, var1, this.h, var4.length);
         this.h += var4.length;
      }

   }

   public int a() {
      return 1;
   }

   public int g() {
      return 1;
   }
}
